<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>密码验证</title>
    <style>
        div{
            width: 600px;
            margin: 100px auto;
        }
        .message{
            display: inline-block;
            font-size: 12px;
            color:#999;
            background: url(../images/307感叹号-三角框.png)no-repeat left center;
            padding-left: 20px;
        }
        .wrong{
            color:red;
            background:url(../images/错误.png)no-repeat left center;
        }
        .right{
            color:green;
            background:url(../images/正确.png)no-repeat left center;
        }
    </style>
</head>
<body>
    <div class="register">
        <input type="text" class="ipt">
        <p class="message">请输入6-11位</p>
    </div>
    <script>
        let ipt=document.querySelector('.ipt');
        let message=document.querySelector('.message');
        ipt.onblur=()=>{
            if(ipt.value.length<6||ipt.value.length>11){
                message.className='message wrong';
                message.innerHTML='error'
            }else{
                message.className='message right';
                message.innerHTML='run'
            }
        }
    </script>
</body>
</html>